<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
	<head>
		<meta name="renderer" content="webkit">
		<title><%=org.nw.Global.getPropertyValue("product.title") %></title>
		<%@ include file="/common/header.jsp"%>
		<%if(debug){ %>
			<script type="text/javascript" src="<c:url value="/index/Index.js"/>"></script>
			<script type="text/javascript" src="<c:url value="/index/Workspace.js"/>"></script>
			<script type="text/javascript" src="<c:url value="/index/QuickLink.js"/>"></script>
			<script type="text/javascript" src="<c:url value="/index/ShortcutPanel.js"/>"></script>
		<%}else{ %>
			<script type="text/javascript" src="<%=request.getContextPath() %>/index/index-min.js?v=<%=version %>"></script>
		<%} %>
		<link href="<%=request.getContextPath() %>/css/index.css" rel="stylesheet" type="text/css"></link>
	</head>
	<body>
	</body>
	<%@ include file="/common/footer.jsp"%>
	<script>
	var indexPage=null;
	function logout(){
		window.location.href="<c:url value="/logout.do"/>";
	}
	//编辑密码
	function openEditPasswordWin(){
		openNode("changPwd","修改密码",ctxPath+"/password/index.html",true,true);
	}
	/**
	 * 打开功能节点
	 * 
	 * @nodeId		节点id
	 * @title		标题 
	 * @url			iframe地址
	 * @isActive	是否设置为当前活动tab页签
	 * @isCloseable	是否可关闭
	 */
	function openNode(nodeId,title,url,isActive,isCloseable){
		var tab = new Ext.ux.IFrameComponent({
    		id : nodeId,
   			title : title,
   			tabTip : title,
   			closable: isCloseable,
   			border : false,
            autoScroll: true,
			url : url,
			layout : 'fit'
		});
   		indexPage.mainPanel.add(tab);
   		if(isActive){
   			indexPage.mainPanel.setActiveTab(tab);
   		}
	}
	/*使用触发左边菜单树打开功能节点*/
	function fireTreeNode(funCode){
		if(funCode.length <= 2){
			uft.Utils.showWarnMsg('打开的节点编码不正确！');	
			return;
		}
		var tree = Ext.getCmp(funCode.substring(0,2));
		var node = tree.getNodeById(funCode);
		if(node==undefined){
			uft.Utils.showWarnMsg('打开的节点不存在！');	
			return;
		}
		tree.fireEvent('click', node);
	}
	
	/**
	* 关闭功能节点
	*/
	function closeNode(nodeId){
		var comp = getNode(nodeId);
		if(comp){
			comp.destroy();
		}
	}
	
	/**
	* 返回功能节点所在地tabPanel
	* 子页面可能需要通过该方法得到tabPanel，再进行相应的操作，如注册事件。
	*/
	function getNode(nodeId){
		return Ext.getCmp(nodeId);
	}
	
	/**
	 * 页面初始化
	 */
	Ext.onReady(function(){
		Ext.QuickTips.init();
		Ext.BLANK_IMAGE_URL='<%=request.getContextPath()%>/theme/<%=theme%>/images/default/s.gif';
		indexPage=new uft.index.Index({funVOs:'${funVOs}',
			corpName : '<%=loginInfo.getCorp_name() %>',
			userCode : '<%=loginInfo.getUser_code() %>',
			userName : '<%=loginInfo.getUser_name() %>'
		});
		//默认打开页面
		openNode("default","我的桌面","<c:url value="/default.html"/>",true,false);
		window.collapseLeft = function(){
			var left = Ext.getCmp('leftPanel');
			if(left){
		 		if(!left.collapsed){
		 			left.collapse();
		 		}else{
		 			left.expand();
		 		}
	 		}
			var header = Ext.getCmp('headerPanel');
			if(header){
				if(!header.collapsed){
					header.collapse();
		 		}else{
		 			header.expand();
		 		}
			}
		};
	});
	
	function keepSessionAlive(){
		Utils.doAsyncRequest('keepSessionAlive.json');
	}
	//每半个小时请求一次
	setUftInterval(keepSessionAlive,this,1800000);
	setUftTimeout(function(){
	    uft.Utils.doAjax({
	    	scope : this,
	    	url : 'checkLicense.json',
	    	isTip : false
	    });
	},this,100);
	</script>
</html>
